<?php

/*********** Konfiguration ********************
****
**** Schrittweite: Wieviele Suchergebnisse pro Seite */
$sw = ($params['sw'])?$params['sw']:10;
/****
**********************************************/

if ($env->getParam('search_query'))
{
   $sth = $dba->siteSearch($site_id,$lang_id,$env->getParam('search_query'));
   if (is_object($sth))
   {
     if (file_exists($cfgPaths['template'].'cms/app/search/'.$lang_name.'.langpack'))
     {
       include_once($cfgPaths['template'].'cms/app/search/'.$lang_name.'.langpack');
     }
     $num_rows = $sth->num_rows();
     printf($resultstring."<br /><br />",$num_rows,'"'.$env->getParam('search_query').'"');
     if (($env->getParam('sst')-$sw) > -1) {
      print '[<a href="'.$env->getServer('SCRIPT_NAME').'?doc_id='.$doc_id.'&site_id='.$site_id.'&lang_id='.$lang_id.'&sst='.((int)$env->getParam('sst')-$sw).'&search_query='.urlencode($env->getParam('search_query')).'">'.$prev.'</a>] ';
     }
     if (($env->getParam('sst')+$sw)<$num_rows)
     {
        print '[<a href="'.$env->getServer('SCRIPT_NAME').'?doc_id='.$doc_id.'&site_id='.$site_id.'&lang_id='.$lang_id.'&sst='.($env->getParam('sst')+$sw).'&search_query='.urlencode($env->getParam('search_query')).'">'.$next.'</a>]';
     }
     if ($num_rows>0)
     {
        $sth->setCursor((int)$env->getParam('sst'));
        $end = (($env->getParam('sst')+$sw)<$num_rows)?($env->getParam('sst')+$sw):$num_rows;
        for ($i=$env->getParam('sst');$i<$end;$i++)
        {
            $row = $sth->fetch_row_Array();
            print "<dl><dt><b><a href=\"".$tpl->prepareLink('pageid:'.$row['doc_id'])."\">".($i+1).".".$row['doc_title']."</a></b></dt>";
            print "<dd>".$row['doc_description']."</dd></dl>\n";
        }
     }
   }
}


?>